﻿/*
* SHARPUPNP
* 
* Written by Marco Minerva, mailto:marco.minerva@gmail.com
* 
* This code is released under the GNU General Public License (GPL) v2.
* A copy of this license is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpUpnp
{
    /// <summary>
    /// Represent an error that occurs during a message exanghe with an UPnP compliant device.
    /// </summary>
    public class UpnpException : Exception
    {
        #region Properties

        /// <summary>
        /// Gets the code of the error caused by the request, if any.
        /// </summary>
        /// <value>The error code for the request, if any.</value>
        /// <remarks>If the <strong>ErrorCode</strong> property is grater than 0, the <see cref="Description"/> property contains a description message for the error.</remarks>
        public int Code { get; internal set; }

        /// <summary>
        /// Gets the description of the error caused by the request, if any.
        /// </summary>
        /// <value>The error code for the request, if any.</value>
        /// <remarks>The <strong>ErrorDescription</strong> property is assigned only if the <see cref="Code"/> property is grater than 0.</remarks>
        public string Description { get; internal set; }

        #endregion

        internal UpnpException()
        { }

        /// <summary>
        /// Initializes a new <see cref="UpnpException"/> object.
        /// </summary>
        /// <param name="code">The error code for the request.</param>
        /// <param name="description">The error description for the request.</param>
        /// <seealso cref="Code"/>
        /// <seealso cref="Description"/>
        public UpnpException(int code, string description)
        {
            this.Code = code;
            this.Description = description;
        }
    }
}
